package com.qby.common.utils;

import com.alibaba.fastjson.JSON;
import com.qby.framework.web.AjaxResult;
import lombok.extern.slf4j.Slf4j;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @description: 描述
 * @author: qiu bo yang
 * @create: 2020-03-26 10:45
 */
@Slf4j
public class CommonUtils {
    public static void responseResult(HttpServletResponse response, AjaxResult result) {
        response.setCharacterEncoding("UTF-8");
        response.setHeader("Content-type", "application/json;charset=UTF-8");
        response.setStatus(200);
        try {
            response.getWriter().write(JSON.toJSONString(result));
        } catch (IOException ex) {
            log.error(ex.getMessage());
        }
    }
}
